using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Globalization;

namespace IReaper.Configurations
{
    public partial class LanguageSelection : Form
    {
        public LanguageSelection()
        {
            InitializeComponent();
        }

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            foreach (CultureInfo culture in LocalizationManager.CultureList)
            {
                this.comboxCultures.Items.Add(culture.NativeName);
            }
        }

        private void SetCulture(object sender, EventArgs e)
        {
            if (this.comboxCultures.SelectedIndex < 0)
                return;
            LocalizationManager.SetCurrentCulture(this.comboxCultures.SelectedIndex);
            this.Close();
            this.DialogResult = DialogResult.OK;
        }

        private void QuitApplication(object sender, EventArgs e)
        {
            this.Close();
            this.DialogResult = DialogResult.Cancel;
        }

        private void Update(object sender, EventArgs e)
        {
            if (this.comboxCultures.SelectedIndex >= 0)
                this.btnOK.Enabled = true;
        }
    }
}